<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-unix;$(NetCoreAppCurrent)-android;$(NetCoreAppCurrent)-ios;$(NetCoreAppCurrent)-tvos;$(NetCoreAppCurrent)-browser;$(NetCoreAppCurrent)-wasi;$(NetCoreAppCurrent)</TargetFrameworks>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <UseCompilerGeneratedDocXmlFile>false</UseCompilerGeneratedDocXmlFile>
  </PropertyGroup>

  <!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
  <PropertyGroup>
    <TargetPlatformIdentifier>$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)'))</TargetPlatformIdentifier>
    <GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetPlatformIdentifier)' == ''">SR.PlatformNotSupported_SystemConsole</GeneratePlatformNotSupportedAssemblyMessage>
    <DefineConstants Condition="'$(TargetPlatformIdentifier)' == 'Browser'">$(DefineConstants);TARGET_BROWSER</DefineConstants>
    <DefineConstants Condition="'$(TargetPlatformIdentifier)' == 'wasi'">$(DefineConstants);TARGET_WASI</DefineConstants>
  </PropertyGroup>

  <ItemGroup Condition="'$(TargetPlatformIdentifier)' != ''">
    <Compile Include="System\Console.cs" />
    <Compile Include="System\ConsoleCancelEventArgs.cs" />
    <Compile Include="System\ConsoleColor.cs" />
    <Compile Include="System\ConsoleSpecialKey.cs" />
    <Compile Include="System\ConsoleKey.cs" />
    <Compile Include="System\ConsoleKeyInfo.cs" />
    <Compile Include="System\ConsoleModifiers.cs" />
    <Compile Include="System\IO\ConsoleStream.cs" />
    <Compile Include="System\IO\CachedConsoleStream.cs" />
    <Compile Include="System\IO\SyncTextReader.cs" />
    <Compile Include="System\IO\Error.cs" />
    <Compile Include="$(CommonPath)DisableRuntimeMarshalling.cs"
             Link="Common\DisableRuntimeMarshalling.cs" />
    <Compile Include="$(CommonPath)System\Text\ConsoleEncoding.cs"
             Link="Common\System\Text\ConsoleEncoding.cs" />
    <Compile Include="$(CommonPath)System\Text\ValueStringBuilder.cs"
             Link="Common\System\Text\ValueStringBuilder.cs" />
    <Compile Include="$(CommonPath)System\Text\ValueStringBuilder.AppendSpanFormattable.cs"
             Link="Common\System\Text\ValueStringBuilder.AppendSpanFormattable.cs" />
  </ItemGroup>

  <!-- iOS/tvOS -->
  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'ios' or '$(TargetPlatformIdentifier)' == 'tvos'">
    <Compile Include="System\ConsolePal.iOS.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Log.cs"
             Link="Common\Interop\Unix\Interop.Log.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
             Link="Common\Interop\Unix\Interop.Libraries.cs" />
  </ItemGroup>

  <!-- Android -->
  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'android'">
    <Compile Include="System\ConsolePal.Android.cs" />
    <Compile Include="$(CommonPath)Interop\Android\Interop.Logcat.cs">
      <Link>Common\Interop\Android\Interop.Logcat.cs</Link>
    </Compile>
    <Compile Include="$(CommonPath)Interop\Android\Interop.Libraries.cs">
      <Link>Common\Interop\Android\Interop.Libraries.cs</Link>
    </Compile>
  </ItemGroup>

  <!-- Browser -->
  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'browser'">
    <Compile Include="System\ConsolePal.WebAssembly.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Dup.cs"
             Link="Common\Interop\Unix\Interop.Dup.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Write.cs"
             Link="Common\Interop\Unix\Interop.Write.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
             Link="Common\Interop\Unix\Interop.Libraries.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Errors.cs"
             Link="Common\Interop\Unix\Interop.Errors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.FileDescriptors.cs"
             Link="Common\Interop\Unix\Interop.FileDescriptors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.IOErrors.cs"
             Link="Common\Interop\Unix\Interop.IOErrors.cs" />
  </ItemGroup>

  <!-- WASI is like unix without dup and termio -->
  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'wasi'">
    <Compile Include="System\ConsolePal.Wasi.cs" />
    <Compile Include="System\ConsolePal.Unix.ConsoleStream.cs" />
    <!-- 
    <Compile Include="System\IO\SyncTextReader.Unix.cs" />
     -->

    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.StdinReady.cs"
             Link="Common\Interop\Unix\Interop.StdinReady.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.ReadStdinUnbuffered.cs"
             Link="Common\Interop\Unix\Interop.ReadStdinUnbuffered.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Poll.cs"
             Link="Common\Interop\Unix\Interop.Poll.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Poll.Structs.cs"
             Link="Common\Interop\Unix\Interop.Poll.Structs.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Read.cs"
             Link="Common\Interop\Unix\Interop.Read.cs" />
    <Compile Include="$(CommonPath)System\Text\EncodingHelper.Unix.cs"
             Link="Common\System\Text\EncodingHelper.Unix.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Write.cs"
             Link="Common\Interop\Unix\Interop.Write.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
             Link="Common\Interop\Unix\Interop.Libraries.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Errors.cs"
             Link="Common\Interop\Unix\Interop.Errors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.FileDescriptors.cs"
             Link="Common\Interop\Unix\Interop.FileDescriptors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.IOErrors.cs"
             Link="Common\Interop\Unix\Interop.IOErrors.cs" />
  </ItemGroup>

  <!-- Windows -->
  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'windows'">
    <Compile Include="System\ConsolePal.Windows.cs" />
    <Compile Include="$(CommonPath)System\Text\OSEncoding.Windows.cs"
             Link="Common\System\Text\OSEncoding.Windows.cs" />
    <Compile Include="$(CommonPath)System\Text\OSEncoder.cs"
             Link="Common\System\Text\OSEncoder.cs" />
    <Compile Include="$(CommonPath)System\Text\DBCSDecoder.cs"
             Link="Common\System\Text\DBCSDecoder.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetCPInfoEx.cs"
             Link="Common\Interop\Windows\Interop.GetCPInfoEx.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.MAX_PATH.cs"
             Link="Common\Interop\Windows\Interop.MAX_PATH.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Interop.Libraries.cs"
             Link="Common\Interop\Windows\Interop.Libraries.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Interop.BOOL.cs"
             Link="Common\Interop\Windows\Interop.BOOL.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.Beep.cs"
             Link="Common\Interop\Windows\Interop.Beep.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.FormatMessage.cs"
             Link="Common\Interop\Windows\Interop.FormatMessage.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.ConsoleCursorInfo.cs"
             Link="Common\Interop\Windows\Interop.ConsoleCursorInfo.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.ConsoleScreenBufferInfo.cs"
             Link="Common\Interop\Windows\Interop.ConsoleScreenBufferInfo.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Interop.Errors.cs"
             Link="Common\Interop\Windows\Interop.Errors.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.FillConsoleOutputAttribute.cs"
             Link="Common\Interop\Windows\Interop.FillConsoleOutputAttribute.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.FillConsoleOutputCharacter.cs"
             Link="Common\Interop\Windows\Interop.FillConsoleOutputCharacter.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.FileTypes.cs"
             Link="Common\Interop\Windows\Interop.FileTypes.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetConsoleScreenBufferInfo.cs"
             Link="Common\Interop\Windows\Interop.GetConsoleScreenBufferInfo.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetConsoleCP.cs"
             Link="Common\Interop\Windows\Interop.GetConsoleCP.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetConsoleTitle.cs"
             Link="Common\Interop\Windows\Interop.GetConsoleTitle.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetConsoleMode.cs"
             Link="Common\Interop\Windows\Interop.GetConsoleMode.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetConsoleOutputCP.cs"
             Link="Common\Interop\Windows\Interop.GetConsoleOutputCP.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetLargestConsoleWindowSize.cs"
             Link="Common\Interop\Windows\Interop.GetLargestConsoleWindowSize.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetFileType_IntPtr.cs"
             Link="Common\Interop\Windows\Interop.GetFileType.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\User32\Interop.GetKeyState.cs"
             Link="Common\Interop\Windows\Interop.GetKeyState.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.GetStdHandle.cs"
             Link="Common\Interop\Windows\Interop.GetStdHandle.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.HandleTypes.cs"
             Link="Common\Interop\Windows\Interop.HandleTypes.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.MultiByteToWideChar.cs"
             Link="Common\Interop\Windows\Interop.MultiByteToWideChar.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.PeekConsoleInput.cs"
             Link="Common\Interop\Windows\Interop.PeekConsoleInput.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.ReadFile_IntPtr.cs"
             Link="Common\Interop\Windows\Interop.ReadFile.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.ReadConsole.cs"
             Link="Common\Interop\Windows\Interop.ReadConsole.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.ReadConsoleInput.cs"
             Link="Common\Interop\Windows\Interop.ReadConsoleInput.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.ReadConsoleOutput.cs"
             Link="Common\Interop\Windows\Interop.ReadConsoleOutput.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleCP.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleCP.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleCursorPosition.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleCursorPosition.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleOutputCP.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleOutputCP.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleScreenBufferSize.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleScreenBufferSize.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleTextAttribute.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleTextAttribute.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleTitle.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleTitle.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.SetConsoleWindowInfo.cs"
             Link="Common\Interop\Windows\Interop.SetConsoleWindowInfo.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WideCharToMultiByte.cs"
             Link="Common\Interop\Windows\Interop.WideCharToMultiByte.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WriteFile_IntPtr.cs"
             Link="Common\Interop\Windows\Interop.WriteFile.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WriteConsole.cs"
             Link="Common\Interop\Windows\Interop.WriteConsole.cs" />
    <Compile Include="$(CommonPath)Interop\Windows\Kernel32\Interop.WriteConsoleOutput.cs"
             Link="Common\Interop\Windows\Interop.WriteConsoleOutput.cs" />
    <Compile Include="$(CommonPath)System\Text\EncodingHelper.Windows.cs"
             Link="Common\System\IO\EncodingHelper.Windows.cs" />
    <Compile Include="$(CommonPath)System\IO\Win32Marshal.cs"
             Link="Common\System\IO\Win32Marshal.cs" />
  </ItemGroup>

  <!-- Unix -->
  <ItemGroup Condition="'$(TargetPlatformIdentifier)' == 'unix'">
    <Compile Include="System\ConsolePal.Unix.cs" />
    <Compile Include="System\ConsolePal.Unix.ConsoleStream.cs" />
    <Compile Include="System\TerminalFormatStrings.cs" />
    <Compile Include="$(CommonPath)System\Console\ConsoleUtils.cs"
             Link="Common\System\Console\ConsoleUtils.cs" />
    <Compile Include="System\TermInfo.cs" />
    <Compile Include="System\TermInfo.WellKnownStrings.cs" />
    <Compile Include="System\TermInfo.Database.cs" />
    <Compile Include="System\TermInfo.DatabaseFactory.cs" />
    <Compile Include="System\TermInfo.WellKnownNumbers.cs" />
    <Compile Include="System\IO\StdInReader.cs" />
    <Compile Include="System\IO\SyncTextReader.Unix.cs" />
    <Compile Include="System\IO\KeyParser.cs" />
    <Compile Include="$(CoreLibSharedDir)System\IO\PersistedFiles.Unix.cs"
             Link="Common\System\IO\PersistedFiles.Unix.cs" />
    <Compile Include="$(CoreLibSharedDir)System\IO\PersistedFiles.Names.Unix.cs"
             Link="Common\System\IO\PersistedFiles.Names.Unix.cs" />
    <Compile Include="$(CommonPath)System\Text\EncodingHelper.Unix.cs"
             Link="Common\System\Text\EncodingHelper.Unix.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"
             Link="Common\Interop\Unix\Interop.Libraries.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Errors.cs"
             Link="Common\Interop\Unix\Interop.Errors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.IOErrors.cs"
             Link="Common\Interop\Unix\Interop.IOErrors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Close.cs"
             Link="Common\Interop\Unix\Interop.Close.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Dup.cs"
             Link="Common\Interop\Unix\Interop.Dup.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.FileDescriptors.cs"
             Link="Common\Interop\Unix\Interop.FileDescriptors.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.FLock.cs"
             Link="Common\Interop\Unix\Interop.FLock.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetControlCharacters.cs"
             Link="Common\Interop\Unix\Interop.GetControlCharacters.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.IsATty.cs"
             Link="Common\Interop\Unix\Interop.IsATty.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Open.cs"
             Link="Common\Interop\Unix\Interop.Open.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.OpenFlags.cs"
             Link="Common\Interop\Unix\Interop.OpenFlags.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Poll.cs"
             Link="Common\Interop\Unix\Interop.Poll.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\Interop.Poll.Structs.cs"
             Link="Common\Interop\Unix\Interop.Poll.Structs.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetEUid.cs"
             Link="Common\Interop\Unix\Interop.GetEUid.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetPwUid.cs"
             Link="Common\Interop\Unix\Interop.GetPwUid.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.SetTerminalInvalidationHandler.cs"
             Link="Common\Interop\Unix\Interop.SetTerminalInvalidationHandler.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.SetSignalForBreak.cs"
             Link="Common\Interop\Unix\Interop.SetSignalForBreak.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.SNPrintF.cs"
             Link="Common\Interop\Unix\Interop.SNPrintF.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Stat.cs"
             Link="Common\Interop\Unix\Interop.Stat.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Read.cs"
             Link="Common\Interop\Unix\Interop.Read.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.Write.cs"
             Link="Common\Interop\Unix\Interop.Write.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.GetWindowWidth.cs"
             Link="Common\Interop\Unix\Interop.GetWindowWidth.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.InitializeTerminalAndSignalHandling.cs"
             Link="Common\Interop\Unix\Interop.InitializeTerminalAndSignalHandling.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.ReadStdinUnbuffered.cs"
             Link="Common\Interop\Unix\Interop.ReadStdinUnbuffered.cs" />
    <Compile Include="$(CommonPath)Interop\Unix\System.Native\Interop.StdinReady.cs"
             Link="Common\Interop\Unix\Interop.StdinReady.cs" />
  </ItemGroup>

  <ItemGroup>
    <Reference Include="System.Collections" />
    <Reference Include="System.Memory" />
    <Reference Include="System.Runtime" />
    <Reference Include="System.Runtime.InteropServices" />
    <Reference Include="System.Text.Encoding.Extensions" />
    <Reference Include="System.Threading" />
    <Reference Include="Microsoft.Win32.Primitives" />
  </ItemGroup>

</Project>
